Integrand size = 32, antiderivative size = 61 \[ \int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx=\frac {B x}{b}-\frac {2 a B \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b \sqrt {a+b} d} \]
[Out]
Time = 0.07 (sec) , antiderivative size = 61, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {21, 2814, 2738, 211} \[ \int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx=\frac {B x}{b}-\frac {2 a B \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b d \sqrt {a-b} \sqrt {a+b}} \]
[In]
[Out]
Rule 21
Rule 211
Rule 2738
Rule 2814
Rubi steps \begin{align*} \text {integral}& = B \int \frac {\cos (c+d x)}{a+b \cos (c+d x)} \, dx \\ & = \frac {B x}{b}-\frac {(a B) \int \frac {1}{a+b \cos (c+d x)} \, dx}{b} \\ & = \frac {B x}{b}-\frac {(2 a B) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b d} \\ & = \frac {B x}{b}-\frac {2 a B \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b \sqrt {a+b} d} \\ \end{align*}
Time = 0.03 (sec) , antiderivative size = 59, normalized size of antiderivative = 0.97 \[ \int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx=\frac {B \left (c+d x+\frac {2 a \text {arctanh}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}\right )}{b d} \]
[In]
[Out]
Time = 0.86 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.08
method | result | size |
derivativedivides | \(\frac {2 B \left (\frac {\arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b}-\frac {a \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{d}\) | \(66\) |
default | \(\frac {2 B \left (\frac {\arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b}-\frac {a \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{d}\) | \(66\) |
risch | \(\frac {B x}{b}-\frac {a B \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right )}{\sqrt {-a^{2}+b^{2}}\, d b}+\frac {a B \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, d b}\) | \(153\) |
[In]
[Out]
none
Time = 0.29 (sec) , antiderivative size = 231, normalized size of antiderivative = 3.79 \[ \int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx=\left [-\frac {\sqrt {-a^{2} + b^{2}} B a \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) - 2 \, {\left (B a^{2} - B b^{2}\right )} d x}{2 \, {\left (a^{2} b - b^{3}\right )} d}, -\frac {\sqrt {a^{2} - b^{2}} B a \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) - {\left (B a^{2} - B b^{2}\right )} d x}{{\left (a^{2} b - b^{3}\right )} d}\right ] \]
[In]
[Out]
Timed out. \[ \int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx=\text {Timed out} \]
[In]
[Out]
Exception generated. \[ \int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 245 vs. \(2 (52) = 104\).
Time = 0.34 (sec) , antiderivative size = 245, normalized size of antiderivative = 4.02 \[ \int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx=-\frac {\frac {{\left (\sqrt {a^{2} - b^{2}} B {\left (2 \, a - b\right )} {\left | a - b \right |} + \sqrt {a^{2} - b^{2}} B {\left | a - b \right |} {\left | b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \sqrt {\frac {1}{2}} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {2 \, a + \sqrt {-4 \, {\left (a + b\right )} {\left (a - b\right )} + 4 \, a^{2}}}{a - b}}}\right )\right )}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} b^{2} + {\left (a^{3} - 2 \, a^{2} b + a b^{2}\right )} {\left | b \right |}} + \frac {{\left (2 \, B a - B b - B {\left | b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {2 \, \sqrt {\frac {1}{2}} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {2 \, a - \sqrt {-4 \, {\left (a + b\right )} {\left (a - b\right )} + 4 \, a^{2}}}{a - b}}}\right )\right )}}{b^{2} - a {\left | b \right |}}}{d} \]
[In]
[Out]
Time = 0.83 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.66 \[ \int \frac {\cos (c+d x) (a B+b B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx=\frac {2\,B\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d}+\frac {2\,B\,a\,\mathrm {atanh}\left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}\right )}{b\,d\,\sqrt {b^2-a^2}} \]
[In]
[Out]